package my.test.bean.ex11;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.convert.support.DefaultConversionService;

import java.util.Date;

public class Main {
	@Test
	public void  testStringToPhoneNumberConvert() {
		String[] configs = {"/my/test/bean/ex11/applicationContext.xml"};
		ApplicationContext ctx = new ClassPathXmlApplicationContext(configs);
/*		DefaultConversionService conversionService = new DefaultConversionService();
		conversionService.addConverter(new String2DateConverter());*/
		DefaultConversionService conversionService = (DefaultConversionService)ctx.getBean("conversionService");
		Date convert = conversionService.convert("2020-08-30 12:00:00", Date.class);
		System.out.println(convert);
	}
}
